package com.cndongtai.service.torchn;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.cndongtai.dao.impl.TorchnBatteryCollectRecordDao;
import com.cndongtai.dao.impl.TorchnInverterCollectRecordDao;
import com.cndongtai.po.TorchnBatteryCollectRecord;
import com.cndongtai.po.TorchnInverterCollectRecord;

@Service("torchnService")
public class TorchnService {
	
	@Resource(name="torchnBatteryCollectRecordDao")
	private TorchnBatteryCollectRecordDao torchnBatteryCollectRecordDao;
	
	@Resource(name="torchnInverterCollectRecordDao")
	private TorchnInverterCollectRecordDao torchnInverterCollectRecordDao;
	
	
	public boolean addTorchnBatteryCollectRecord(TorchnBatteryCollectRecord record) {
		
		int result = torchnBatteryCollectRecordDao.addTorchnBatteryCollectRecord(record);
		
		return result>0 ? true : false;
		
	}
	
	public double queryBatteryChargeQuantity(String deviceName) {
		
		Double quantity = torchnBatteryCollectRecordDao.queryBatteryChargeQuantity(deviceName);
		return quantity==null? 0:quantity;
	}
	
	public double queryBatteryWorkQuantity(String deviceName) {
		Double quantity = torchnBatteryCollectRecordDao.queryBatteryWorkQuantity(deviceName);
		return quantity==null? 0:quantity;
	}
	
	public List<TorchnBatteryCollectRecord> queryBatteryCollectRecord(String deviceName) {
		return torchnBatteryCollectRecordDao.queryBatteryCollectRecord(deviceName);
	}
	
	
	public boolean addTorchnInverterCollectRecord(TorchnInverterCollectRecord record) {
		
		int result = torchnInverterCollectRecordDao.addTorchnInverterCollectRecord(record);
		
		return result>0 ? true : false;
		
	}
	
	public List<TorchnInverterCollectRecord> queryInverterCollectRecord(String deviceName) {
		return torchnInverterCollectRecordDao.queryInverterCollectRecord(deviceName);
	}
 
}
